package lexer;

import lexer.DFA.TokenType;


public class Token {

	public TokenType type;
	public Object data;

	public TokenType getType() {
		return type;
	}

	public Object getData() {
		if(data.getClass().isInstance(String.class)){
			return (String)data;
		}
		else if(data.getClass().isInstance(Integer.class)){
			return (int)data;
		}
		else {
			return data;
		}
		
	}
	public int getDataValue(){
		return (int)data;
	}

	public Token(TokenType type, String data) {
		this.type = type;
		this.data = data;
	}
	public Token(TokenType type, int data){
		this.type = type;
		this.data = data;
	}

	@Override
	public String toString() {
		return String.format("(%s %s)", type.name(), data);
	}
}
